package com.atguigu.spzx.manager.controller;

import com.atguigu.spzx.manager.service.FileUploadService;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.model.vo.common.ResultCodeEnum;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName: FileUploadController
 * @Package: com.atguigu.spzx.manager.controller
 * @Description 上传文件
 * @Author 孤妤
 * @Date: 2023/12/5 15:48
 */
@Tag(name = "文件上传")
@RestController
@RequestMapping("/admin/system/file")
public class FileUploadController {
    @Autowired
    private FileUploadService fileUploadService;
    @PostMapping("/fileUpload")
    @Operation(summary = "上传文件")
    public Result<String> fileUploadService(MultipartFile file) {
        String fileUrl = fileUploadService.fileUpload(file) ;
        return Result.build(fileUrl , ResultCodeEnum.SUCCESS) ;
    }
}
